home *** CD-ROM | disk | FTP | other *** search
- /*
- ** backgmmn.doc - history file
-
- Program : PC-Gammon IV with User-Defined ** COLOR **
- Computer : 100% IBM PC compatibles
- Language : Microsoft C 4.00
- :
- Author : David C. Oshel
- : 1219 Harding Avenue
- : Ames, Iowa 50010
- : August 10, 1986
-
-
- HISTORY
- -------
- v7.0 6/13/87 - Ported from MSC 4.0 to Turbo C 1.0. Generally an easy port,
- but Turbo C has a number of undocumented macros, such as
- min() and max() in stdlib.h, that were briefly a puzzle.
- Also, MS C "signal" replaced by Turbo C "ctrlbrk", and various
- other small edits such as "alloc.h" instead of "malloc.h",
- "farfree" for "_ffree", etc. Turbo C introduced a number
- of functions or macros which collided with names I had
- already defined -- esp. sleep(), peek(), min(), max().
-
- Compile the CIAO.C module using UNSIGNED CHARS, as there
- is a difference in implementation there somewhere. This
- may have introduced a bug into Typeafile, which no longer
- wordwraps properly. Borland seems to have found ways to
- prefer idiosyncrasy even in ANSI standard C.
-
- The program runs noticeably faster -- sounds are higher
- pitched, play is excessively rapid, etc. -- under Turbo C.
-
-
- v6.0 9/08/86 - Now linking to CIAO.LIB, with fast video RAM output
-
- v5.3 9/01/86 - Minor change, just added typeafile for the user's manual.
- Typeafile is a new addition to the IO.LIB.
-
- v5.2 8/21/86 - Got rid of clairol.obj, in favor of an improved io.lib.
- Includes ambiguity test in clairol(), adds a mode
- argument to the vid_init() routine, adds a vid_exit()
- routine. The library is smaller, and allows a smaller
- obj file where only sound or keyin is needed. The clairol()
- function now does a wputs("^0"); on exit to ensure the new
- normal mode is set.
-
- PC-Gammon now allows a command line parameter.
- Sets video mode 2 instead of video mode 3, if present.
- Usage: backgmmn b&w
-
- Actually, any argument will do, but document "b&w" for users.
-
-
-
- v5.1 8/18/86 - minor add: "^0" to mycount(), yrcount() format strings
- minor edits in backgmmn.h to remove obsolete function decls
-
- Note that wprintf("^%d", cnt); is DANGEROUS, depending on
- how the cnt argument gets formatted. The correct usage in
- this case is wprintf("^0%d", cnt);, with the zero! This
- ensure that the ^ escape finds a legitimate command char in
- the anticipated position.
-
- Note that the current main() and command() fns in bg0.c were
- split apart in version 5.0: vid_init() was in the wrong
- place to correctly save the startup screen for cga! The
- public domain version is ok, has the change. Note also that
- setting video mode 3 absolutely will clear the cga startup
- screen and send cursor home, so there's no point saving it,
- but we do it anyway. It's a good screen to come home to.
-
- TO DO: ruminate on improvements in playing strategy. Torve
- seems unexpectedly strong, lately. Have I overlooked some
- strength not noted there before? Need to pin that last bug
- in the Arrange command, if I can figure out what it is! Is
- Torve reacting to full moon? Are small but noticeable changes
- in strategy the result of using a $600 compiler for a change?
- Have I finally gone mad?
-
-
- Version 5.0 August 17, 1986, the LAST public domain version of PC-Gammon!
-
- a) Reorganized the code into four sensible modules, with a
- common header file, for use with MAKE. The source files are
- backgmmn.h, bg0.c, bg1.c, bg2.c, bg3.c. Supporting modules
- are clairol.obj, and its .h file.
-
- b) Revised code to use the new wprintf() function. (<stdarg.h> in
- Microsoft C 4.0 is magic!)
-
- Simplified the savescreen(), restorescreen() calls to do automatic
- heap allocation/free.
-
- c) Added the CLAIROL module to change screen attributes.
- (Combined module from CURSES.C, SOUND.C., plus clairol() routine.)
-
- d) In other words, PC-Gammon now has full color support for the cga
- and color monitor. WITHOUT sacrificing special support for the
- monochrome adapter.
-
-
-
- Version 4.4 August 12, 1986
-
- a) Revised BGTOKENS.C to default to my preferred stones.
- b) Added H(ues stub to main command line, if not monochrome.
-
- Version 4.3 August 10, 1986
-
- a) Minor changes to CURSES.OBJ file. Variables for screen
- attributes can support color selection in a H(ues command.
- Appended the old GETMS file to CURSES. Some changes in
- argument order for windowing commands (in the direction
- of easier to remember and more consistent).
-
- Version 4.2 August 3, 1986
-
- a) V.4.1 FAILED its test on the cga card! Modified CURSES.OBJ to
- correctly set 80x25 text 16/8 mode on PCs with cga cards. Moved
- call to title() into setup(), so the change is noted before
- anything is output to screen. Tested results on NCR PC Model 3
- with cga, and on Epson Equity I. Passed with flying colors (for
- B&W, that is)!
-
- Version 4.1 August 2, 1986
-
- a) Minor revision to CURSES.OBJ allows wink() to handle '\b'.
- Discovered that Microsoft C 3.00 interprets '\008' as '\0',
- not '\b', so changed the backgammon source code accordingly.
-
- Version 4.0 August 2, 1986 (PC clone version Gammon IV.40)
-
- a) Added sound and ultra-fast screen io. Makes it a game for 100%
- clones only, now. Totally ignores ANSI.SYS, if present.
-
- b) Altered keyin() and getms() to accept function parameters for
- the wait-for-input and the do-on-ESC routines. For separate
- compilation later (maybe).
-
- c) Revised references to '\n' in user input routines because
- keyin() does not return newline when it encounters ENTER.
- In effect, the "All ok?" question now accepts ENTER and does
- not force users to type 'Y'.
-
- d) Fixed a bug in user's dice routine.
-
- e) Known BUG: Computer does not come in from the bar on the first
- roll after Arrange-ing the board.
-
-
-
- Version 3.1: July 29, 1986 (MS-DOS version Gammon IV.31)
-
- a) Changed the keyin() routine to correctly handle Fn key inputs.
- Extended ASCII is returned with high bit set from now on.
-
-
-
- Version 3: July 27, 1986 (Original MS-DOS version Gammon IV.30)
-
- a) Numerous minor changes to the code reflect differences in
- C compilers and their standard libraries. In particular,
- Microsoft C implements some functions as macros -- locating all
- the side effects of this approach can be troublesome when
- porting.
-
- Otherwise, this is just a "quick and dirty" port; old code which
- implemented for the Lear-Siegler ADM-3A terminal's lack of a
- clear-to-end-of-line command has not been optimized (or cleaned
- up, depending on your point of view).
-
- b) The graphics toggle (CP/M Kaypro) is a hilite toggle (MS-DOS ANSI).
-
- c) User bailout is ESC. Control-C is trapped by MS-DOS and halts
- the program.
-
- d) The "kill typeahead" feature (in BG0.C) is commented out to improve
- play under the abominably slow conditions of IBM-clone i/o.
-
-
-
- Version 2: March 28, 1986 (CP/M)
-
- a) Fixed the bug in which the doubling cube might revert to its
- default value if the computer took back a move, and if the cube
- had been doubled one or more times during the opening roll-off
- but not yet offered.
-
- b) Fixed an odd bug in the Arrange command which occasionally caused
- stones to switch allegiance to the opponent's color, or else to
- mysteriously multiply to more than 15 on a side.
-
- c) An improved error handler now hints that BAR and HOME are words
- used in the game; also, slows down the incorrect entry routine so
- that it is less mysterious than before.
-
- d) Added a Graphic toggle to main command line. Same as Control-K,
- as in previous versions; turns on/off the Kaypro '84 video graphics;
- uses the alternate token set defined in the CRT module below.
-
- e) Changed the break character back to Control-C; there is a
- proximity problem in keyboarding the escape key on a Kaypro
- keyboard. (Various CP/M versions may have used either ESC or
- Control-C, depending.)
-
- f) There is no longer a sanction against cheating; if you bail
- out during play and re-Arrange the stones, your opponent
- does not change.
-
- g) As before, the computer will not always take (or find) a forced
- move. The rule is that the player must take both dice if possible,
- or the larger if both are possible singly but not together.
- The playing algorithm attempts to find the legally required move,
- but will sometimes fail. It is sometimes advantageous to avoid a
- forced move but the computer cannot make that distinction in this
- version; the program allows the same lenience for the human player.
-
- The cube is doubled when doubles are thrown during the opening
- rolloff to decide who goes first. However, if the cube reaches 8,
- further pairs on the dice during rolloff have no effect.
-
- Gammon IV knows all the other OFFICIAL rules of the game;
- U.S. Navy and/or Saloon rules don't count.
-
- h) Improved coding in some routines, especially putstone(), which was
- far more baroque than necessary. There is also some occasional
- re-coding, where I could not prevent myself. The game strategy
- has not been changed, mostly because I don't fully understand it
- anymore, even though the documentation there is better than usual.
- It was written months ago in a white heat of inspiration; but I
- feel reluctant to submit myself to that strain again, without the
- prospect of remuneration.
-
-
- INTRODUCTION
- ------------
-
- Gammon IV is a full-screen backgammon game. I wrote it for CP/M
- some time ago, and have finally gotten around to porting it to MS-DOS.
-
- Gammon IV has always been designed to run nicely on the lowest common
- denominator of available computer terminals. The CP/M version has a
- number of sophisticated i/o features which are nevertheless compatible
- with the Lear-Siegler ADM-3A (extremely) dumb terminal.
-
- This version assumes 100% IBM-compatible io, for screen and sound.
- Screen control is via ROM BIOS calls, sound control uses port io.
-
-
-
-
- DISCUSSION ABOUT THE PORT FROM CP/M TO MS-DOS (Gammon IV.30)
- ------------------------------------------------------------
- This is a straightforward "port" from CP/M to MS-DOS. GAMMON IV was
- originally written for the Kaypro 10. It has now been translated for
- the Epson Equity I, or any IBM-PC clone with an ANSI terminal (below).
-
- The original language was Toolworks C/80, version 3.1 (CP/M), the
- current language is Microsoft C, version 3.00 (MS-DOS).
-
- Program modules have been altered to account for the PC-clone
- environment.
-
- In addition, certain in-line assembly kludges which were required in
- the CP/M version have now been replaced by pure C code in the MS-DOS
- version; i.e., there are some minor changes involving setjmp() and
- longjmp(), which now control program logic in a more portable fashion.
-
-
-
-
- DISCUSSION OF THE PROGRAM
- _________________________
-
- Gammon IV is probably the best FREE backgammon game ever written....
- I'm not modest! I wrote it because I was disgusted with the price
- and dullness of all other public domain programs which allegedly play
- backgammon.
-
- This program has THREE DIFFERENT PLAYING STYLES, any one of which can
- consistently beat a novice player, and occasionally beat a good player.
- In all three levels, the computer's strategy can even seem brilliant;
- there is nothing routine about it.
-
- This version incorporates a few minor changes and bug fixes which make it
- different from previous editions which have appeared on various bulletin
- boards and club offerings around the country. This is a public domain
- program. Feel free to distribute or improve it. Credit to the original
- author (me) will be appreciated, but is not strictly required since the
- copyright owners are abnormally mild-mannered (and extremely distant;
- see Acknowledgments, below.)
-
- Acknowledgments:
-
- The opening dialogue, in which you chose your computer opponent,
- is freely adapted from Alexei Panshin's long out-of-print, and
- now classic, "Star Well" travelogues. Scholars of computer history
- will recognize many allusions to this same opus in various passages
- of Mike Goetz's 550-point Adventure (especially in the Ice Caverns!).
-
- The Xochitl Sodality, which owns the copyright on Gammon IV, is a
- philanthropic society first publicized by Panshin. Persons who wish
- to obtain information on site licensing for Gammon IV should contact
- the Monist Association imaginary properties secretary at the following
- address:
- Monist Association I.P.S.
- c/o Xochitl Sodality
- Semichastny House
- Delbalso, Nashuite Empire
-
-
- */
-
- /* eof: backgmmn.doc */
-